package cn.liyicun.cp.cpweb.mapper;

import cn.liyicun.cp.cpweb.entity.MoneyWithdraw;
import cn.liyicun.cp.cpweb.entity.MoneyWithdrawExample;
import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface MoneyWithdrawMapper extends Serializable {
    @SelectProvider(type=MoneyWithdrawSqlProvider.class, method="countByExample")
    long countByExample(MoneyWithdrawExample example);

    @DeleteProvider(type=MoneyWithdrawSqlProvider.class, method="deleteByExample")
    int deleteByExample(MoneyWithdrawExample example);

    @Delete({
        "delete from money_withdraw",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into money_withdraw (uid, status, ",
        "totle_money, remark, ",
        "create_time, locking, ",
        "update_time)",
        "values (#{uid,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, ",
        "#{totleMoney,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{locking,jdbcType=VARCHAR}, ",
        "#{updateTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(MoneyWithdraw record);

    @InsertProvider(type=MoneyWithdrawSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(MoneyWithdraw record);

    @SelectProvider(type=MoneyWithdrawSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="totle_money", property="totleMoney", jdbcType=JdbcType.DECIMAL),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="locking", property="locking", jdbcType=JdbcType.VARCHAR),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<MoneyWithdraw> selectByExampleWithRowbounds(MoneyWithdrawExample example, RowBounds rowBounds);

    @SelectProvider(type=MoneyWithdrawSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="totle_money", property="totleMoney", jdbcType=JdbcType.DECIMAL),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="locking", property="locking", jdbcType=JdbcType.VARCHAR),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<MoneyWithdraw> selectByExample(MoneyWithdrawExample example);

    @Select({
        "select",
        "id, uid, status, totle_money, remark, create_time, locking, update_time",
        "from money_withdraw",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="totle_money", property="totleMoney", jdbcType=JdbcType.DECIMAL),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="locking", property="locking", jdbcType=JdbcType.VARCHAR),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    MoneyWithdraw selectByPrimaryKey(Long id);

    @UpdateProvider(type=MoneyWithdrawSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") MoneyWithdraw record, @Param("example") MoneyWithdrawExample example);

    @UpdateProvider(type=MoneyWithdrawSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") MoneyWithdraw record, @Param("example") MoneyWithdrawExample example);

    @UpdateProvider(type=MoneyWithdrawSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(MoneyWithdraw record);

    @Update({
        "update money_withdraw",
        "set uid = #{uid,jdbcType=BIGINT},",
          "status = #{status,jdbcType=INTEGER},",
          "totle_money = #{totleMoney,jdbcType=DECIMAL},",
          "remark = #{remark,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "locking = #{locking,jdbcType=VARCHAR},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(MoneyWithdraw record);
}